package com.potenza.goods.controller;

import com.potenza.goods.auth.app.annotation.Login;
import com.potenza.goods.auth.app.feign.UserServiceFeignClient;
import com.potenza.goods.service.GoodsService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.app.annotation.LoginUser;
import io.renren.modules.app.entity.UserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;


/**
 * 商品管理
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-01-05 16:39:00
 */
@RestController
//@CrossOrigin(value = "http://localhost:8001",allowCredentials="true")
@RequestMapping("goodsapp/goods")
public class GoodsAppController {
    @Autowired
    private GoodsService goodsService;

    @Autowired
    private UserServiceFeignClient userServiceFeignClient;
    /**
     * 列表
     */
    @Login
    @RequestMapping("/list")
    public R list(@LoginUser UserEntity user, @RequestParam Map<String, Object> params){
        System.out.println(user.getUserId());
        PageUtils page = goodsService.queryPage(params);

        return R.ok().put("page", page);
    }
}
